<%@ page import="net.zjitc.daomain.Book" %>
<%@ page import="java.util.ArrayList" %><%--
  Created by IntelliJ IDEA.
  User: hasee
  Date: 2017/10/12
  Time: 21:44
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>购物车</title>
</head>
<%
    HttpSession session1 = request.getSession();
    ArrayList<Book> cart = (ArrayList) session1.getAttribute("cart");
    String msg = "";
    if(session1 == null){
        msg="对不起，您还没有购买任何的图书，请先选择。。。。";
    }
    if (cart == null || cart.size()==0){
        msg="您的购物车为空";
    }else{
        for (Book book:cart) {
            msg=msg + book.getId() + "   " + book.getName();
            msg=msg +"<a href=\"/web/deleteStrvlet?id="+book.getId()+"\">删除</a>" + "</br>";
        }
    }
%>
<body>
    <form action="/deleteStrvlet">
        <table>
            <tr>
                <td>购物车:</td>
            </tr>
            <tr>
                <td><%= msg%></td>
            </tr>
            <tr>
                <td><a href="/web/cart/listbook.jsp">继续购物</a></td>
            </tr>
        </table>
    </form>
</body>
</html>
